import Vue from 'vue';
import App from './App.vue';
import router from './router';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios';       
import { handleTree } from "./utils/ruoyi";
import { getToken } from './utils/auth';
import * as echarts from 'echarts';
import './assets/icon/iconfont.css'

import 'echarts-gl';

Vue.prototype.$echarts = echarts


Vue.prototype.handleTree = handleTree

Vue.config.productionTip = false


axios.interceptors.request.use(
  config => {
    // 是否需要设置 token
    const isToken = (config.headers || {}).isToken === false
    if (getToken() && !isToken) {
      config.headers.Authorization = getToken()
    }
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

Vue.use(ElementUI)
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')

